<?$this->_extends("_layouts/main_layout");?>
<?$this->_block("contents");?>
<script type="text/javascript">
<!--
function check(){
		return confirm('确定删除吗？');
	
}
//-->
</script>

  <fieldset class="query_form" style="margin-top:10px;">
    <legend><span onclick="show_fld();" style="color:blue;cursor:pointer;">过滤条件</span></legend>
    <div id="filter_show">
    <form class="fsimple" id="form_news_search" name="form_news_search" action="" method="get" enctype="application/x-www-form-urlencoded" qform_group_id="" >
    <table class="form_table" width="100%" cellpadding="0" cellspacing="0">
      <tr height="30">
        <td ><span style="width:40px;">标题：</span>
          <input name="title" type="text"  id="title" value="<?php echo $title;?>" size="30" />
          <span style="width:40px;">类型：</span>
          <select  id="type_id" name="type_id" >
            <?php
			echo '<option value="">请选择</option>';
            foreach($newstype as $k => $v){
				$show = 1;
				if(!empty($news_op)){
					if(!in_array($k,$news_op)){
						$show = 0;	
					}
				}
				if($show == 1){
					if($type_id == $k){
						$sel = 'selected';	
					}else{
						$sel = '';	
					}
					echo '<option value="'.$k.'" '.$sel.'>'.str_replace('━━','&nbsp;&nbsp;&nbsp;&nbsp;',$v).'</option>';
				}
            }
            ?>
          </select>
          <span style="width:100px;">是否在首页显示：</span>
          <select  id="home_flag" name="home_flag" >
            <?php
			echo '<option value="">请选择</option>';
            foreach($flag as $k => $v){
				if(strlen($home_flag) && $home_flag == $k){
					$sel = 'selected';	
				}else{
					$sel = '';	
				}
                echo '<option value="'.$k.'" '.$sel.'>'.$v.'</option>';
            }
            ?>
          </select>
          <span style="width:60px;">是否置顶：</span>
          <select  id="top_flag" name="top_flag" >
            <?php
			echo '<option value="">请选择</option>';
            foreach($flag as $k => $v){
				if(strlen($top_flag) && $top_flag == $k){
					$sel = 'selected';	
				}else{
					$sel = '';	
				}
                echo '<option value="'.$k.'" '.$sel.'>'.$v.'</option>';
            }
            ?>
          </select>
          <input type="submit" class="btn1" value="查 询"  style="width:80px;" />
          &nbsp;&nbsp;
          <input type = "reset" class="btn" value="重置" onclick="window.location.href='<?php echo url('');?>';" style="width:80px;">
          &nbsp;&nbsp;
          <?php if (hp('news.2')) {?>
		<input type="button" class="btn1" value="添加"  onclick="window.location.href='<?php echo url('news/create');?>';" style="width:80px;margin-top:7px;" />
		<?php }?>
        </td>
      </tr>
    </table>
   </form>
   </div> 
  </fieldset>


<form class="fsimple" id="form_news" name="form_news" action="" method="get" enctype="application/x-www-form-urlencoded" qform_group_id="" >
<table class="list_table" width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <th width="">序号</th>
    <th width="">标题</th>
    <th width="">类型</th>
    <th width="">重点/推荐</th>
    <th width="">是否在首页显示</th>
    <th width="">是否置顶</th>
    <th width="">添加时间</th>
    <?php if (hp('news.3') || hp('news.4')) {?>
    <th width="">操作</th>
    <?php }?>
  </tr>
  <?php
	//print_r($list);
 foreach ($list as $i=>$row) {
	 ?>
  <tr>
    <td><?php echo $i+$start+1?></td>
    <td><?php echo stripslashes(str_replace($title,'<font color=red>'.$title.'</font>',$row['title']));?></td>
    <td><?php if(array_key_exists($row['type_id'],$newstype)){echo str_replace('━','',str_replace('┕','',$newstype[$row['type_id']]));}else{echo '----';}?></td>
    <td><?php if($row['recommend_flag'] == 1){echo '<font color=red>是</font>';}else{echo '否';}?></td>
    <td><?php if($row['home_flag'] == 1){echo '<font color=red>是</font>';}else{echo '否';}?></td>
    <td><?php if($row['top_flag'] == 1){echo '<font color=red>是</font>';}else{echo '否';}?></td>
    <td><?php echo date('Y-m-d',$row['release_date'])?></td>
    <?php if (hp('newstype.3') || hp('newstype.4')) {?>
    <td>
    	<?php if (hp('news.3')) {?>
        	<a href="<?=url('news/edit', array('id'=>$row['id']))?>" style="color:blue;" title="修改">[修改]</a>&nbsp;
        <?php }?>
        <?php if (hp('news.4')) {?>
        	<a href="<?=url('news/delete', array('id'=>$row['id']))?>" onclick="return check()" style="color:blue;" title="删除">[删除]</a>
        <?php }?>
    </td>
    <?php }?>
  </tr> 
  <? }?>
</table>

</form>
<br>
<? $this->_control("pagination", "", array('pagination'=>$pager));?>
<? $this->_endblock();?>
